winform程序测试加密数据库连接字段 winform浏览器(谷歌内核)webkit内核
public partial class SQLSet : Form
{
string iNewLine = System.Environment.NewLine;
string iDES = "";
string iFormTilte = "CRRC";
string iFormGroup = "TV1";
string iFormConn = "CRRC";
public SQLSet()
{
InitializeComponent();
iFormTilte = "CRRC";
iFormGroup = "TV1";
iFormConn = "CRRC";
}
private void BTNTest_Click(object sender, EventArgs e)
{
if (XMLCenter.TestConn(txtSQLString.Text))
{
MessageBox.Show("数据库连接成功!");
}
else
{
MessageBox.Show("连接数据库失败!");
}
txtDES.Text = EncryptCenter.EncryptDES(txtSQLString.Text, "CRRC2016");
txtGroup.Text = iFormGroup;
}
private void SQLSet_Load(object sender, EventArgs e)
{
txtSQLString.Focus();
iDES = EncryptCenter.EncryptDES(txtSQLString.Text, "CRRC2016");
List<RefreshInfo> iRInfo = new ReadConfig().Read(ref iFormTilte, ref iFormGroup, ref iFormConn);
//txtGroup.Text = iFormGroup;
txtDES.Text = iDES;
}
private void BTNUpdate_Click(object sender, EventArgs e)
{
if (XMLCenter.TestConn(txtSQLString.Text))
{
iFormGroup = "TV1";
iFormConn = "CRRC";
iFormTilte = "CRRC";
iDES = EncryptCenter.EncryptDES(txtSQLString.Text, "CRRC2016");
txtDES.Text = iDES;
XMLCenter.Write(iFormTilte, iFormGroup, iDES, "");
MessageBox.Show("更新成功!");
Application.Restart();
}
else
{
MessageBox.Show("更新失败!");
}
}
private void BTNStart_Click(object sender, EventArgs e)
{
if (txtSQLString.Text == "M")
{
txtSQLString.Text = EncryptCenter.DecryptDES(iFormConn, "CRRC2016");
}
else
{
txtSQLString.Text = "data source=.;database=MES_HYGDJT;uid=sa;pwd=1234;Connect Timeout=500";
}
txtGroup.Text = iFormGroup;
txtDES.Text = EncryptCenter.EncryptDES(txtSQLString.Text, "CRRC2016");
}
private void BTNCreateIE_Click(object sender, EventArgs e)
{
XMLCenter.WriteGM(CreateReg(GetIEValue(CBIE.Text)), CBIE.Text ".reg");
MessageBox.Show("创建成功!");
Application.Exit();
//创建注册表文件
}
private string GetIEValue(string iIEVer)
{
string t = "00001f40";
switch (iIEVer)
{
case "IE9":
t = "00002328";
return t;
case "IE10":
t = "00002710";
return t;
case "IE11":
t = "00002af8";
return t;
}
return t;
}
private string CreateReg(string strIEHEX)
{
string t;
t = "";
t = "Windows Registry Editor Version 5.00" iNewLine;
t = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION]" iNewLine;
t = "\"QBrowserCRRC.exe\"=dword:" strIEHEX iNewLine;
t = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_BROWSER_EMULATION]" iNewLine;
t = "\"QBrowserCRRC.exe\"=dword:" strIEHEX iNewLine;
return t;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
//case Keys.F1:
// MessageBox.Show(XMLCenter.XMLTemplete("Go").ToString());
// return true;
case Keys.Escape:
this.Hide();
return true;
}
return false;
}
}
评论